package com.aya.copy.tools.action.generate;

import com.intellij.psi.PsiClass;

public class ListGenerator implements Generator {
    String listName = "list";
    private PsiClass selectedClass;

    public ListGenerator(final PsiClass selectedClass) {

        this.selectedClass = selectedClass;
    }

    @Override
    public String getDeclaring() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("List<").append(selectedClass.getName()).append(">");
        stringBuilder.append(listName).append(" = ");
        stringBuilder.append("new ArrayList<>();").append("\n");
        return stringBuilder.toString();
    }

    @Override
    public String addBean(String itemName) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(listName).append(".add(").append(itemName).append(");").append("\n");
        return stringBuilder.toString();
    }


}
